// File:    Permiso.cs
// Author:  bigmaster
// Created: viernes, 22 de noviembre de 2013 1:14:56
// Purpose: Definition of Class Permiso

using System;
namespace ServiceDeskUNAB.Modelo
{
    public class Permiso
    {
        private int idPermiso;

        public int IdPermiso
        {
            get { return idPermiso; }
            set { idPermiso = value; }
        }
        private string nombrePermiso;

        public string NombrePermiso
        {
            get { return nombrePermiso; }
            set { nombrePermiso = value; }
        }

        public System.Collections.Generic.List<Rol> rol;

        /// <summary>
        /// Property for collection of Rol
        /// </summary>
        /// <pdGenerated>Default opposite class collection property</pdGenerated>
        public System.Collections.Generic.List<Rol> Rol
        {
            get
            {
                if (rol == null)
                    rol = new System.Collections.Generic.List<Rol>();
                return rol;
            }
            set
            {
                RemoveAllRol();
                if (value != null)
                {
                    foreach (Rol oRol in value)
                        AddRol(oRol);
                }
            }
        }

        /// <summary>
        /// Add a new Rol in the collection
        /// </summary>
        /// <pdGenerated>Default Add</pdGenerated>
        public void AddRol(Rol newRol)
        {
            if (newRol == null)
                return;
            if (this.rol == null)
                this.rol = new System.Collections.Generic.List<Rol>();
            if (!this.rol.Contains(newRol))
                this.rol.Add(newRol);
        }

        /// <summary>
        /// Remove an existing Rol from the collection
        /// </summary>
        /// <pdGenerated>Default Remove</pdGenerated>
        public void RemoveRol(Rol oldRol)
        {
            if (oldRol == null)
                return;
            if (this.rol != null)
                if (this.rol.Contains(oldRol))
                    this.rol.Remove(oldRol);
        }

        /// <summary>
        /// Remove all instances of Rol from the collection
        /// </summary>
        /// <pdGenerated>Default removeAll</pdGenerated>
        public void RemoveAllRol()
        {
            if (rol != null)
                rol.Clear();
        }
    }
}